package org.mifos.boss.domainmodel;

import java.sql.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

//import org.apache.axis.encoding.ser.castor.CastorSerializerFactory;

@Entity

public class ClientCreationalData {
	
	
//	private int transferId;
	private int tempCustId;
	private String clientName;
	private short clientStatus;
	private Date mfiJoiningDate;
	private String externalId;
	private short formedBy;
	private Date dateOfBirth;
	private String governmentId;
	private boolean istrained;
	private Date tainingDate;
	private short groupFlag;
	//private InputStream picture;
	private String parentGroupId;
	private short loanOfficerId;
	private Date activationDate;
	
	//private ClientNameDetails clientNameDetail;
	
	//additional column for persistence
	private Mobile2BossData mobile2BossData;
	//one to one mapping
	private Address address;
	private ClientPersonalDetails clientPersonalDetails;
	
	//one to many
	private List<ApplicableAccountFeeType> applicableAccountType;
	private List<ClientFamilyDetails> clientFamilyDetails;
	private List<ClientNameDetails> clientNameDetails;
	private List<SavingProducts> savingProducts;
	
	
	
	
//	public int getTransferId() {
//		return transferId;
//	}
//	public void setTransferId(int transferId) {
//		this.transferId = transferId;
//	}
	
	@Id
	@GeneratedValue
	@Column(name="TEMP_CUST_ID")
	public int getTempCustId() {
		return tempCustId;
	}
	public void setTempCustId(int tempCustId) {
		this.tempCustId = tempCustId;
	}
	public String getClientName() {
		return clientName;
	}
	public void setClientName(String clientName) {
		this.clientName = clientName;
	}
	public short getClientStatus() {
		return clientStatus;
	}
	public void setClientStatus(short clientStatus) {
		this.clientStatus = clientStatus;
	}
	public Date getMfiJoiningDate() {
		return mfiJoiningDate;
	}
	public void setMfiJoiningDate(Date mfiJoiningDate) {
		this.mfiJoiningDate = mfiJoiningDate;
	}
	public String getExternalId() {
		return externalId;
	}
	public void setExternalId(String externalId) {
		this.externalId = externalId;
	}
	public short getFormedBy() {
		return formedBy;
	}
	public void setFormedBy(short formedBy) {
		this.formedBy = formedBy;
	}
	public Date getDateOfBirth() {
		return dateOfBirth;
	}
	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}
	public String getGovernmentId() {
		return governmentId;
	}
	public void setGovernmentId(String governmentId) {
		this.governmentId = governmentId;
	}
	public boolean isIstrained() {
		return istrained;
	}
	public void setIstrained(boolean istrained) {
		this.istrained = istrained;
	}
	public Date getTainingDate() {
		return tainingDate;
	}
	public void setTainingDate(Date tainingDate) {
		this.tainingDate = tainingDate;
	}
	public short getGroupFlag() {
		return groupFlag;
	}
	public void setGroupFlag(short groupFlag) {
		this.groupFlag = groupFlag;
	}
	/*
	public InputStream getPicture() {
		return picture;
	}
	public void setPicture(InputStream picture) {
		this.picture = picture;
	}*/
	public String getParentGroupId() {
		return parentGroupId;
	}
	public void setParentGroupId(String parentGroupId) {
		this.parentGroupId = parentGroupId;
	}
	public short getLoanOfficerId() {
		return loanOfficerId;
	}
	public void setLoanOfficerId(short loanOfficerId) {
		this.loanOfficerId = loanOfficerId;
	}
	public Date getActivationDate() {
		return activationDate;
	}
	public void setActivationDate(Date activationDate) {
		this.activationDate = activationDate;
	}
	
	@ManyToOne
	@JoinColumn(name="TRANSFER_ID")
	public Mobile2BossData getMobile2BossData() {
		return mobile2BossData;
	}
	public void setMobile2BossData(Mobile2BossData mobile2BossData) {
		this.mobile2BossData = mobile2BossData;
	}
	
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	public Address getAddress() {
		return address;
	}
	public void setAddress(Address address) {
		this.address = address;
	}
	
	@OneToMany(targetEntity=ApplicableAccountFeeType.class, mappedBy="clientCreationalData",
			cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	public List<ApplicableAccountFeeType> getApplicableAccountType() {
		return applicableAccountType;
	}
	public void setApplicableAccountType(List<ApplicableAccountFeeType> applicableAccountType) {
		this.applicableAccountType = applicableAccountType;
	}
	
	@OneToMany(targetEntity=ClientFamilyDetails.class, mappedBy="clientCreationalData",
			cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	public List<ClientFamilyDetails> getClientFamilyDetails() {
		return clientFamilyDetails;
	}
	public void setClientFamilyDetails(List<ClientFamilyDetails> clientFamilyDetails) {
		this.clientFamilyDetails = clientFamilyDetails;
	}
	
	@OneToMany(targetEntity=ClientNameDetails.class, mappedBy="clientCreationalData",
			cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	public List<ClientNameDetails> getClientNameDetails() {
		return clientNameDetails;
	}
	public void setClientNameDetails(List<ClientNameDetails> clientNameDetails) {
		this.clientNameDetails = clientNameDetails;
	}
	
	@OneToOne(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	public ClientPersonalDetails getClientPersonalDetails() {
		return clientPersonalDetails;
	}
	public void setClientPersonalDetails(ClientPersonalDetails clientPersonalDetails) {
		this.clientPersonalDetails = clientPersonalDetails;
	}
	
	@OneToMany(targetEntity=SavingProducts.class, mappedBy="clientCreationalData",
			cascade=CascadeType.ALL, fetch=FetchType.LAZY)
	public List<SavingProducts> getSavingProducts() {
		return savingProducts;
	}
	public void setSavingProducts(List<SavingProducts> savingProducts) {
		this.savingProducts = savingProducts;
	}
/*	public ClientNameDetails getClientNameDetail() {
		return clientNameDetail;
	}
	public void setClientNameDetail(ClientNameDetails clientNameDetail) {
		this.clientNameDetail = clientNameDetail;
	}
*/
}
